package com.dm.saleassback.projectmanage.controller;

import com.dm.saleassback.projectmanage.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.sql.SQLException;
import java.util.Map;

@Controller
@Transactional
@CrossOrigin
public class ProjectController {
    @Autowired
    private ProjectService projectService;

    /**
         * @Description 查询项目
         * @Author zhangxue
         * @Date 16:55 2018/5/31
         * @Param
         * @retrun
         **/
    @RequestMapping(value="/queryAllProject",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> queryAllProject(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = projectService.queryAllProject(param);
        return statusMap;
    }

    /**
     * @Description 新增项目信息
     * @Author zhangxue
     * @Date 15:05 2018/6/1
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/saveProject",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> saveProject(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = projectService.saveProject(param);
        return statusMap;
    }

    /**
     * @Description 删除项目信息
     * @Author zhangxue
     * @Date 15:06 2018/6/1
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/deleteProjectById",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> deleteProjectById(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = projectService.deleteProjectById(param);
        return statusMap;
    }

    /**
     * @Description 修改项目信息
     * @Author zhangxue
     * @Date 15:09 2018/6/1
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/updateProjectById",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> updateProjectById(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = projectService.updateProjectById(param);
        return statusMap;
    }


}
